[Access] Properly handle subscription errors in data providers#7046
Conversation
Distinguish between `context.Canceled` errors originating from the streamer and those triggered by the DataProvider’s `Close()` method. Use `wasClosedByClient()` to suppress expected cancellations while propagating unexpected ones
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #7046 +/- ##
=======================================
Coverage 41.25% 41.25%
=======================================
Files 2170 2170
Lines 190050 190098 +48
=======================================
+ Hits 78409 78429 +20
- Misses 105097 105123 +26
- Partials 6544 6546 +2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
After discussing with Yurii, we agreed to use a different approach here. |
As this will changed, will re-aprove final implementation
We use it to distinguish place where cxt.Canceled error comes from. Also, I refactored each data provider's Run() function. Now it's more readable and clear.
peterargue
left a comment
There was a problem hiding this comment.
why is this refactor needed? can you point out the important changes, it's not clear to me
Hey. I updated PR's description. Added a context of what has been done and why. |
engine/access/rest/websockets/data_providers/account_statuses_provider.go
Outdated
Show resolved
Hide resolved
engine/access/rest/websockets/data_providers/account_statuses_provider.go
Outdated
Show resolved
Hide resolved
|
@peterargue I also pointed out the most important lines of code |
engine/access/rest/websockets/data_providers/account_statuses_provider.go
Outdated
Show resolved
Hide resolved
engine/access/rest/websockets/data_providers/account_statuses_provider.go
Show resolved
Hide resolved
engine/access/rest/websockets/data_providers/events_provider.go
Outdated
Show resolved
Hide resolved
- Moved creation and start of subscription and streamer to Run() function instead of having it in constructor - Ged rid of ctx in constructor. Moved it to Run() function - Refactored the structure of the base provider
engine/access/rest/websockets/data_providers/account_statuses_provider.go
Outdated
Show resolved
Hide resolved
engine/access/rest/websockets/data_providers/account_statuses_provider.go
Outdated
Show resolved
Hide resolved
engine/access/rest/websockets/data_providers/account_statuses_provider.go
Show resolved
Hide resolved
engine/access/rest/websockets/data_providers/account_statuses_provider.go
Outdated
Show resolved
Hide resolved
peterargue
left a comment
There was a problem hiding this comment.
one small improvement, then this is ready to merge
Originally, the description of the issue was like that
However, after a couple of discussions and work on that, I can conclude that the first 3 clauses are outdated and were removed from the implementation. The only thing we left is the refactoring and the fact that we start the ubscription after a Run() method has been called.
Closes #7040 #7047